package com.pignest.framework.json;

public class JsonInteger extends JsonValue {
	private final int value;

	public JsonInteger(int value) {
		this.value = value;
	}

	public JsonInteger(long value) {
		this.value = (int)value;
	}

	public JsonInteger(double value) {
		this.value = (int)value;
	}

	public JsonInteger(String text) {
		this.value = Integer.parseInt(text);
	}

	@Override
	public double getDouble() {
		return value;
	}

	@Override
	public long getLong() {
		return value;
	}

	@Override
	public int getInteger() {
		return value;
	}

	@Override
	public String toExternalRepresentation() {
		return Integer.toString(value);
	}
}
